home *** CD-ROM | disk | FTP | other *** search
/ L' Effet Pommier 3 / L'Effet Pommier - Volume 03.iso / Programmation / Alpha ƒ / Tcl / SystemCode / emacs.tcl < prev    next >
Text File  |  1996-01-08  |  2KB  |  119 lines

  1.  
  2. # Emacs-ish bindings.
  3. bind 0x33 <e>      backwardDeleteWord 
  4. bind 'b' <es>    backwardWordSelect 
  5. bind '<' <se>     beginningOfBuffer 
  6. bind 'b' <X>    chooseWindowStatus 
  7. bind 'l' <X>    currentPosition 
  8. bind ')' <Xs>    endKeyboardMacro 
  9. bind '>' <se>     endOfBuffer 
  10. bind 'x' <Xz>    exchangePointAndMark 
  11. bind 'w' <Xz>    saveAs 
  12. bind 'e' <X>    executeKeyboardMacro 
  13. bind 'f' <Xz>    findFile 
  14. bind 'f' <es>     forwardWordSelect 
  15. bind '\ ' <e>    oneSpace 
  16. bind 'c' <z>     prefixChar 
  17. bind 'x' <z>     prefixChar 
  18. bind 'r' <e>     repeatSearchBackward 
  19. bind 's' <e>     repeatSearchForward 
  20. bind 's' <Xz>    save 
  21. bind '(' <sX>    startKeyboardMacro 
  22. bind 'o' <X>    otherThing 
  23. bind '1' <X>    zoom 
  24. bind 'k' <X>    killWindowStatus
  25. bind 'u' <X>    upcaseWord
  26.  
  27.  
  28. proc emacsMenu {} {
  29.     global useEmacs
  30.     if {$useEmacs} {    
  31.         menu -n emacs {
  32.             "/F<BforwardChar"
  33.             "/B<BbackwardChar"
  34.             "/D<BdeleteChar"
  35.             "/N<BnextLine"
  36.             "/P<BpreviousLine"
  37.             "(-"
  38.             "/F<IforwardWord"
  39.             "/B<IbackwardWord"
  40.             "/D<IdeleteWord"
  41.             "/v<IdeleteWord"
  42.             "/H<IbackwardDeleteWord"
  43.             "/u<IbackwardDeleteWord"
  44.             "(-"
  45.             "/K<BkillLine"
  46.             "/Y<Byank"
  47.             "/A<BbeginningOfLine"
  48.             "/E<BendOfLine"
  49.             "/O<BopenLine"
  50.             "(-"
  51.             "/V<BpageForward"
  52.             "/V<IpageBack"
  53.             "/L<BcenterRedraw"
  54.             "(-"
  55.             "/ <BsetMark"
  56.             "/W<Bcut"
  57.             "/W<Icopy"
  58.             "(-"
  59.             "/C<IcapitalizeWord"
  60.             "upcaseWord"
  61.             "/L<IdowncaseWord"
  62.             "(-"
  63.             "/X<Iexecute"
  64.             "/U<BiterationCount"
  65.             "/G<BabortEm"
  66.             "(-"
  67.             "disableEmacs"
  68.         }
  69.     } else {
  70.         menu -n emacs { enableEmacs }
  71.     }
  72. }
  73. emacsMenu
  74.  
  75.  
  76. proc disableEmacs {} {
  77.     global useEmacs modifiedVars
  78.     lappend modifiedVars useEmacs
  79.     set useEmacs 0
  80.     emacsMenu
  81. }
  82.  
  83. proc enableEmacs {} {
  84.     global useEmacs modifiedVars
  85.     lappend modifiedVars useEmacs
  86.     set useEmacs 1
  87.     emacsMenu
  88. }
  89.  
  90.  
  91. bind 'f' <e> forwardWord
  92. bind 'b' <e> backwardWord
  93. bind 'd' <e> deleteWord
  94. bind 'h' <e> backwardDeleteWord
  95. bind 'v' <e> pageBack
  96. bind 'w' <e> copy
  97. bind 'g' <e> gotoLine
  98. bind 'e' <e> nextSentence
  99. bind 'a' <e> prevSentence
  100. bind 'c' <e> capitalizeWord
  101. bind 'u' <e> upcaseWord
  102. bind 'l' <e> downcaseWord
  103. bind 'x' <e> execute
  104. bind 0x31  <e> oneSpace
  105. bind 0x31  <o> oneSpace
  106.  
  107.  
  108. proc killRegion {} {
  109.     set from [getMark]
  110.     set to [getPos]
  111.     if {$to < $from} {
  112.         deleteText $to $from
  113.     } else {
  114.         deleteText $from $to
  115.     }
  116. }
  117.  
  118. bind 'd' <X>    killRegion
  119.